package advance.JVM.concurrent;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * description: <br>
 * createTime: 2018/12/2718:03 <br>
 *
 * @author zzh
 */
public class TestTTT {
    static int i = 0;
    public static void main(String[] args) throws InterruptedException {
        ExecutorService es = Executors.newFixedThreadPool(100);
        CountDownLatch countDownLatch = new CountDownLatch(100);
        for (int j = 0; j < 100; j++) {
            es.submit(() -> {
                for (int k = 0; k < 100000; k++) {
                    i++;
                }
                countDownLatch.countDown();
            });
        }
        es.shutdown();
        countDownLatch.await();
        System.out.println(i);
    }
}
